package com.zyy.zyy.controller;

import com.github.pagehelper.PageInfo;
import com.zyy.zyy.entity.DataDO;
import com.zyy.zyy.entity.DataDOKey;
import com.zyy.zyy.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class NoticeController {
    @Resource
    NoticeService noticeService;

 @GetMapping("/notice/list/{pageNum}/{pageSize}")
 @ResponseBody
    public PageInfo<DataDO> notice(
         @PathVariable("pageNum") Integer pageNum, @PathVariable("pageSize") Integer pageSize){
     PageInfo<DataDO> pageInfo = noticeService.getAllNotice(pageNum,pageSize);
          return pageInfo;
    }

    @GetMapping("/notice/noticeDetail")
   @ResponseBody
    public DataDO noticeDetail(DataDOKey key){
        System.out.println(key);
        return noticeService.getNoticeDetail(key);


    }
}
